/***************************************************************************//**
 * @file GUI/PFD_VSI.h
 * @author  Marek M. Cel <marekcel@mscsim.org>
 *
 * @section LICENSE
 *
 * Copyright (C) 2013 Marek M. Cel
 *
 * This file is part of MScSim. You can redistribute and modify it under
 * the terms of GNU General Public License as published by the Free Software
 * Foundation; either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Further information about the GNU General Public License can also be found
 * on the world wide web at http://www.gnu.org.
 ******************************************************************************/
#ifndef PFD_VSI_H
#define PFD_VSI_H

////////////////////////////////////////////////////////////////////////////////

#include <QGraphicsView>
#include <QGraphicsSvgItem>

////////////////////////////////////////////////////////////////////////////////

class PFD_VSI
{
public:

    /** */
    PFD_VSI( QGraphicsScene *scene );

    /** */
    void init( float scaleX, float scaleY );

    /** */
    void update( float scaleX, float scaleY );

    /** @param climb rate (dimensionless numeric value)  */
    void setClimbRate( float climbRate );

private:

    QGraphicsScene *m_scene;    ///< graphics scene

    QGraphicsSvgItem  *m_itemScale;     ///< climb rate scale
    QGraphicsSvgItem  *m_itemArrow;     ///< climb rate arrow

    float m_climbRate;

    float m_arrowDeltaY_new;
    float m_arrowDeltaY_old;

    float m_scaleX;
    float m_scaleY;

    const float m_originalMarkeHeight;
    const float m_originalPixPerSpd1;   ///< [px/vertical speed unit] up to 100 vsu
    const float m_originalPixPerSpd2;   ///< [px/vertical speed unit] from 100 to 200 vsu
    const float m_originalPixPerSpd4;   ///< [px/vertical speed unit] from 200 to 400 vsu

    QPointF m_originalScalePos;
    QPointF m_originalArrowPos;

    const int m_scaleZ;
    const int m_arrowZ;

    /** */
    void reset();

    /** */
    void updateVSI();
};

////////////////////////////////////////////////////////////////////////////////

#endif // PFD_VSI_H
